#ifndef TREE_H
#define TREE_H


struct TNode{
    char data;
    TNode* lch;
    TNode* rch;
    TNode()
    {
        this->lch=0;
        this->rch=0;
    }
};

class Tree
{
public:
    Tree();
    ~Tree();
    void createTree(const char* str);
    void printTree(TNode* root);
    void printTree();
    void deleteTree(TNode* &root);

    TNode* copyTree(TNode* src);

    void preTree();
    void inTree();
    void postTree();

    TNode* m_root;
    //binary search tree,ms 1
    bool insertBST(TNode* &root,char c);
    TNode* createBST(const char* src);

    TNode* BST2List(TNode* root);
    void printList(TNode* root);
    //ms 4
    bool printPath(int n, TNode *root,char st[],int top);
    void printPath(int n,TNode* root);
};

#endif // TREE_H
